// 数据库集合的相关配置
// 1、定义数据集合的结构：定义出集合中数据有哪些属性，属性的值是什么类型
const { Schema, model } = require('mongoose');

// -- ----------- 严晴---------- --

// 用户
const customersSchema = new Schema({
    username: String,
    password: String,
    name: String,
    phone: String,
    age: String,
    gender: String,
    IDCard: String,
    money: {
        type: Number,
        default: 0
    },
    state: {
        type: Number,
        default: 1
    },
    delete: {
        type: Boolean,
        default: false
    },
    productsId: {
        type: Schema.Types.Array,
        ref: 'productsModel'
    },
    ordersId: {
        type: Schema.Types.Array,
        ref: 'ordersModel'
    },
    belongToSales: {
        type: Schema.Types.ObjectId,
        ref: 'salesModel'
    }
}, { versionKey: false });


const customersModel = model('customersModel', customersSchema, 'customers');

module.exports.customersModel = customersModel;